Kwik.Page.include("Kwik.Data.ColumnCollection.js");

/**
* The data column object describes a single data item
* @extends Kwik.Object
* @requires Kwik.Object
* @requires Kwik.Data.ColumnCollection
* @constructor
* @created 12:37 AM 7/29/2009
* @modified 12:38 AM 7/29/2009
*/
Kwik.Data.Column = function(config)
{
	/** @ignore */
	Kwik.Utility.extend(this, "Kwik.Object");
	this.__class.push("Kwik.Data.Column");

	/** Reference to a parent column collection object if any @type Kwik.Data.ColumnCollection */
	this.parent = null;
	/** Ordinal position @type Number */
	this.ordinal = -1;
	/** Name of the column @type String */
	this.name = "";
	/** Label of the column, a user friendly name @type String */
	this.label = "";
	/** Column description @type String */
	this.description = "";
	/** Datatype of the column @type String */
	this.datatype = "varchar";
	/** Value of the column @type Object */
	this.value = null;
	/** Default value of the column @type Object */
	this.defaultValue = null;

	/** Configure this column object @type Kwik.Data.ColumnConfig */
	this.configure = function Column_configure(config)
	{
		config = this.Kwik$Object.configure(config);
		if(config.parent){this.parent = config.parent;}
		if(Kwik.Type.isNumber(config.ordinal)){this.ordinal = config.ordinal;}
		if(config.name){this.name = config.name;}
		if(config.label){this.label = config.label;}
		if(config.description){this.description = config.description;}
		if(config.datatype){this.datatype = config.datatype;}
		if(config.defaultValue){this.defaultValue = config.defaultValue;}
		if(config.value){this.value = config.value;}
		return config;
	};

	/** @ignore */
	this.main = function(config)
	{
		if(config){this.configure(config);}

	}; this.main(config);
};

/**
* Data column configuration object
* @constructor
* @created 12:21 AM 7/29/2009
* @modified 12:21 AM 7/29/2009
*/
Kwik.Data.ColumnConfig = function()
{
	/** Reference to a parent column collection object if any @type Kwik.Data.ColumnCollection */
	this.parent = null;
	/** Ordinal position @type Number */
	this.ordinal = -1;
	/** Name of the column @type String */
	this.name = "";
	/** Label of the column, a user friendly name @type String */
	this.label = "";
	/** Column description @type String */
	this.description = "";
	/** Datatype of the column @type String */
	this.datatype = "";
	/** Value of the column @type Object */
	this.value = null;
};